Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYP: simple return types from ruff #56568

Merged
merged 1 commit into from
Dec 19, 2023
Merged

TYP: simple return types from ruff #56568

merged 1 commit into from
Dec 19, 2023

Conversation

twoertwein
Copy link
Member

Ruff has many "unsafe" autofixes for simple return types.

I hope to enable --unsafe-fixes (for only the type annotations) after a few PRs.

@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Dec 19, 2023
@mroeschke mroeschke added this to the 2.2 milestone Dec 19, 2023
@mroeschke mroeschke merged commit 854012c into pandas-dev:main Dec 19, 2023
48 of 49 checks passed
@mroeschke
Copy link
Member

Thanks @twoertwein

@jorisvandenbossche
Copy link
Member

Is it needed to add -> None to test functions? (generally our test_.. test functions don't have any type annotations at all, I think?)

@twoertwein
Copy link
Member Author

Is it needed to add -> None to test functions? (generally our test_.. test functions don't have any type annotations at all, I think?)

I think it would be good to exclude pandas/tests (and scripts/tests - happy to revert that) from these ruff fixes! I don't think it would add value for the tests (unless people prefer it for consistency).

However, manually adding annotations for tests can be valuable to selectively allow mypy to run on some tests to help with #45252. I believe most test files are completely ignored and unannotated functions are anyways skipped: so we could use -> None to run mypy on a subset of tests within a file.

cbpygit pushed a commit to cbpygit/pandas that referenced this pull request Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants